﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MobaCommon.Config
{
  
    public class TowerData
    {
        /// <summary>
        /// 类型和模型的映射
        /// </summary>
        private static Dictionary<int, TowerDataModel> idTowerModelDic = new Dictionary<int, TowerDataModel>();

        static TowerData()
        {
            CreateBuild((int)TowerType.Main,5000,0,100,0,"主基地",false,false,0);
            CreateBuild((int)TowerType.Camp, 3000, 0, 100, 0, "兵营", false, true, 300);
            CreateBuild((int)TowerType.Turret, 5000, 200, 50, 5, "炮塔", true, false, 0);
        }
        private static void CreateBuild(int typeId, int hp, int attack, int defense, double attackDistance, string name, bool agressire, bool rebirth, int rebirthTime)
        {
            TowerDataModel model = new TowerDataModel( typeId,  hp,  attack,  defense,  attackDistance,  name,  agressire,  rebirth,  rebirthTime);

            idTowerModelDic.Add(typeId,model);
        }
        /// <summary>
        /// 根据类型获取数据
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        public static TowerDataModel GetTowerData(int typeId)
        {
            TowerDataModel model;
            idTowerModelDic.TryGetValue(typeId,out model);
            return model;
        }
    }
    /// <summary>
    /// 塔的数据模型
    /// </summary>
    public class TowerDataModel
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int TypeId { get; set; }
        /// <summary>
        /// 血量
        /// </summary>
        public int Hp { get; set; }
        /// <summary>
        /// 攻击
        /// </summary>
        public int Attack { get; set; }
        /// <summary>
        /// 防御力
        /// </summary>
        public int Defense { get; set; }
        /// <summary>
        /// 攻击距离
        /// </summary>
        public double AttackDistance { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 是否攻击
        /// </summary>
        public bool Agressire { get; set; }
        /// <summary>
        /// 是否重生
        /// </summary>
        public bool Rebirth { get; set; }
        /// <summary>
        /// 重生时间
        /// </summary>
        public int RebirthTime { get; set; }

        public TowerDataModel(int typeId,int hp,int attack,int defense,double attackDistance,string name,bool agressire,bool rebirth,int rebirthTime)
        {
            this.TypeId = typeId;
            this.Hp = hp;
            this.Attack = attack;
            this.Defense = defense;
            this.AttackDistance = attackDistance;
            this.Name = name;
            this.Agressire = agressire;
            this.Rebirth = rebirth;
            this.RebirthTime = rebirthTime;
        }
    }
    public enum TowerType
    {
        //主基地
        Main=1,
        //兵营
        Camp=2,
        //炮塔
        Turret=3
    }
}
